import firedrake
/home/firedrake/firedrake/lib/python3.12/site-packages/pytools/persistent_dict.py:59: UserWarning: pytools.persistent_dict: unable to import 'siphash24.siphash13', falling back to hashlib.sha256
warn("pytools.persistent_dict: unable to import 'siphash24.siphash13', "
/home/firedrake/firedrake/lib/python3.12/site-packages/pytools/__init__.py:2439: UserWarning: unable to find git revision
warn("unable to find git revision", stacklevel=1)
import viskex
import common_firedrake as common # isort: skip
Generate meshes of the unit square by dividing each edge of the square in 6 segments, using either a triangular or quadrangular mesh.
square_tria = firedrake.UnitSquareMesh(6, 6, quadrilateral=False, diagonal="right")
square_quad = firedrake.UnitSquareMesh(6, 6, quadrilateral=True, diagonal="right")
Interpolate the scalar field $x^3 + y^2$, and store it either in a firedrake function or a UFL expression.
square_tria_scalar_field, square_tria_scalar_field_ufl = common.prepare_scalar_field_cases(
square_tria, lambda x: x[0]**3 + x[1]**2)
square_quad_scalar_field, square_quad_scalar_field_ufl = common.prepare_scalar_field_cases(
square_quad, lambda x: x[0]**3 + x[1]**2)
Plot the scalar field with a contour plot.
viskex.firedrake.plot_scalar_field(square_tria_scalar_field, "scalar")
error: XDG_RUNTIME_DIR is invalid or not set in the environment. MESA: error: ZINK: failed to choose pdev glx: failed to create drisw screen
viskex.firedrake.plot_scalar_field(square_tria_scalar_field_ufl, "scalar")
error: XDG_RUNTIME_DIR is invalid or not set in the environment.
MESA: error: ZINK: failed to choose pdev glx: failed to create drisw screen
viskex.firedrake.plot_scalar_field(square_quad_scalar_field, "scalar")
error: XDG_RUNTIME_DIR is invalid or not set in the environment. MESA: error: ZINK: failed to choose pdev glx: failed to create drisw screen
viskex.firedrake.plot_scalar_field(square_quad_scalar_field_ufl, "scalar")
error: XDG_RUNTIME_DIR is invalid or not set in the environment. MESA: error: ZINK: failed to choose pdev glx: failed to create drisw screen
Plot the scalar field with a surface plot.
viskex.firedrake.plot_scalar_field(square_tria_scalar_field, "scalar", warp_factor=0.5)
error: XDG_RUNTIME_DIR is invalid or not set in the environment. MESA: error: ZINK: failed to choose pdev glx: failed to create drisw screen
viskex.firedrake.plot_scalar_field(square_quad_scalar_field, "scalar", warp_factor=0.5)
error: XDG_RUNTIME_DIR is invalid or not set in the environment. MESA: error: ZINK: failed to choose pdev glx: failed to create drisw screen